
<#include "header.ftl">
<link rel="stylesheet" type="text/css" href="${Domain}common/address-master/dist/amazeui.address.css" />
<script src="${Domain}common/address-master/dist/iscroll.min.js" type="text/javascript" charset="utf-8"></script>
<script src="${Domain}common/address-master/dist/address.js" type="text/javascript" charset="utf-8"></script>
  <!-- 内容区域 -->
<div class="tpl-content-wrapper">
 <div class="container-fluid am-cf">
                <div class="row">
                   <div class="am-u-sm-12 am-u-md-12 am-u-lg-9">
                        <ol class="am-breadcrumb">
						  <li><a href="${Domain}my" class="am-icon-home">首页</a></li>
						  <li class="am-active">设置</li>
						  <li class="am-active">配置</li>
						</ol>
                    </div>
                  	<#include "../common/return.ftl">
                </div>
  </div>
       <div class="row-content am-cf">
       
         <div class="row">
  
                    <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                        <div class="widget am-cf">
                            <div class="widget-head am-cf">
                                <div class="widget-title  am-cf">${maintype.name} — <small>${maintype.description}</small></div>
                            </div>
                            <div class="widget-body  am-fr">     
                                    <div class="widget-body widget-body-md am-fr">

                                <div class="am-progress-title">用户数 <span class="am-fr am-progress-title-more">15% / 100%</span></div>
                                <div class="am-progress">
                                    <div class="am-progress-bar" style="width: 15%"></div>
                                </div>
                                <div class="am-progress-title">病人数 <span class="am-fr am-progress-title-more">75% / 100%</span></div>
                                <div class="am-progress">
                                    <div class="am-progress-bar  am-progress-bar-warning" style="width: 75%"></div>
                                </div>
                                <div class="am-progress-title">病案数 <span class="am-fr am-progress-title-more">35% / 100%</span></div>
                                <div class="am-progress">
                                    <div class="am-progress-bar am-progress-bar-danger" style="width: 35%"></div>
                                </div>
                            </div>                    
                            
                            </div>
                        </div>
                    </div>
          </div>    
       
                <div class="row">
  
                    <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                        <div class="widget am-cf">
                            <div class="widget-head am-cf">
                                <div class="widget-title  am-cf">信息更新</div>
                            </div>
                            <div class="widget-body  am-fr">     
                             <form class="am-form tpl-form-line-form"  method="post" action="${Domain}api/main/update" id="main-update">
                                   <input type="hidden" id="id" name="id" value="${main.id}">
                                   <input type="hidden" id="logo" name="logo" value="${main.logo}">
                                    <!--
                                    <div class="am-form-group">
                                        <label for="user-weibo" class="am-u-sm-3 am-u-md-3 am-form-label">LOGO </label>
                                     	
                                        <div class="am-u-sm-8 am-u-md-6">
                                            <div class="am-form-group am-form-file">
                                                <div class="tpl-form-file-img">
                                                    <img id="main-logo" src="${ImgUrl}${main.logo}" alt="" width="100px" height="100px;" >
                                                </div>
                                                <button type="button" class="am-btn am-btn-danger am-btn-sm">
    											<i class="am-icon-cloud-upload"></i> 更换图片</button>
                                                <input id="uportrait-file" type="file" name="upfile" accept="image/jpg,image/jpeg,image/png,image/gif" multiple="">
                                            </div>
											<label  class="am-u-sm-1 am-u-md-3"></label>
                                        </div>
                                    </div>
                                    -->

                                    <div class="am-form-group">
                                        <label  class="am-u-sm-3 am-u-md-3 am-form-label">实体名称 </label>
                                        <div class="am-u-sm-8 am-u-md-6">
                                            <input type="text" class="tpl-form-input" id="main-name" placeholder="请输入名称" name="name" value="${main.name}" required/>
                                        </div>
                                        <label  class="am-u-sm-1 am-u-md-3"></label>
                                    </div>
									 <div class="am-form-group">
                                        <label  class="am-u-sm-3 am-u-md-3 am-form-label">联系人 </label>
                                        <div class="am-u-sm-8 am-u-md-6">
                                            <input type="text" class="tpl-form-input" id="main-contacts" placeholder="请输入联系人姓名" name="contacts" value="${main.contacts}" required/>
                                        </div>
                                        <label  class="am-u-sm-1 am-u-md-3"></label>
                                    </div>
                                     <div class="am-form-group">
                                        <label  class="am-u-sm-3 am-u-md-3 am-form-label">联系电话 </label>
                                        <div class="am-u-sm-8 am-u-md-6">
                                            <input type="tel" class="tpl-form-input"  id="main-telephone" placeholder="请输入联系电话" name="telephone" value="${main.telephone}" required/>
                                        </div>
                                        <label  class="am-u-sm-1 am-u-md-3"></label>
                                    </div>
                                    <div class="am-form-group" id="address">
                                     <label  class="am-u-sm-3 am-u-md-3 am-form-label">所在省份 </label>
                                        <div class="am-u-sm-8 am-u-md-6">
                                            <input readonly type="text" name="prov" id="prov" class="am-form-field am-radius" placeholder="请选择地址"  value="${(prov.name)!}" required/>
                                        </div>
										<label  class="am-u-sm-1 am-u-md-3"></label>		
									</div>
                                     <div class="am-form-group">
                                        <label  class="am-u-sm-3 am-u-md-3 am-form-label">联系地址 </label>
                                        <div class="am-u-sm-8 am-u-md-6">
                                            <input type="text" class="tpl-form-input" id="main-address" placeholder="请输入联系地址" name="address" value="${main.address}" required/>
                                        </div>
                                        <label  class="am-u-sm-1 am-u-md-3"></label>
                                    </div>
                                    <div class="am-form-group">
                                        <label  class="am-u-sm-3 am-u-md-3 am-form-label">说明简介</label>
                                        <div class="am-u-sm-8 am-u-md-6">
                                            <textarea class="" rows="3" id="main-description" name="description" placeholder="请输入简介">${main.description}</textarea>
                                        </div>
                                        <label  class="am-u-sm-1 am-u-md-3"></label>
                                    </div>
                                   <div class="am-form-group">
                                        <div class="am-u-sm-6 am-u-sm-push-3">
                                            <button type="submit" id="sub" class="am-btn page-header-button tpl-btn-bg-color-success am-btn-block">确定修改</button>
                                        </div>
                                    </div>
                                  

                                </form>
                            
                            
                            </div>
                        </div>
                    </div>
                    
                    
                    
                </div>
            </div> 
 </div>   





  <script type="text/javascript">
			$(function() {
				document.addEventListener('touchmove', function (e) {
					e.preventDefault();
				}, false);
				
				
				//	配置级联层数
				$("#address").address({
					prov: "${(prov.name)!}",
					scrollToCenter: true,
					selectNumber: 1
				});

			});
</script>
<script type="text/javascript">
  var loading ; 
$(function() {
	
  $('#main-update').validator({
    onValid: function(validity) {   
      $(validity.field).closest('.am-form-group').find('.am-alert').hide();
    },
    onInValid: function(validity) {
   
      var $field = $(validity.field);
      var $group = $field.closest('.am-form-group');
      var $tpl = $group.find('.tpl-form-input');
      var $alert = $group.find('.am-alert');
      // 使用自定义的提示信息 或 插件内置的提示信息
      var msg = $tpl.data('validationMessage') || this.getValidationMessage(validity);
      if (!$alert.length) {
        $alert = $('<div class="am-alert am-alert-danger"></div>').hide().
          insertAfter($tpl);
      }
      $alert.html(msg).show();
    }
  });
});
  
  
   $('#main-update').ajaxForm({
   		type:'GET',
	    beforeSubmit: function(a,f,o) {
	        loading=weui.loading('数据加载中...');
	    },
	    success: function(json) {	    	
	    	if(json.status)
	    	{
	    	  	if(loading) loading.hide();
	    		weui.toast(json.msg); 
	    			
	    	}else
	    	{	
	    		if(loading) loading.hide();
	    	    weui.alert(json.msg);  		 
	    	}
	    }
	});
	
	
//

$('#uportrait-file').on('change', function () { 
  $("#main-update").ajaxSubmit({
    url:'${Domain}api/upload?action=uploadimage', 
    success: function(json) {

       if(json.state=="SUCCESS")
       {
         $("#logo").val(json.url);
         $("#main-logo").attr("src","${ImgUrl}"+json.url); 
       }else
       {
          weui.topTips(json.state);
       }
    }
  });

});
	</script>          
<#include "footer.ftl">